import numpy as np
# 创建一个示例数组
arr = np.array([1, 2, 3, 4, 5])
# 加法运算
result_add1 = arr + 1
print("加法运算结果：",result_add1)
# 减法运算
result_sub1 = arr - 1
print("减法运算结果：",result_sub1)
# 除法运算
result_div1 = arr / 2
print("除法运算结果：",result_div1)
print()

list = [1, 2, 3, 4, 5]
# 加法
result_add2 = [x + 1 for x in list]
print("加法运算：",result_add2)
# 减法
result_sub2 = [x - 1 for x in list]
print("减法运算：",result_sub2)
# 除法
result_div2 = [x / 2 for x in list]
print("除法运算：",result_div2)
'''元组换成列表后进行同上操作'''
print()

set = {1, 2, 3, 4, 5}
# 加法
result_add3 = {x + 1 for x in set}
print("加法运算：",result_add3)
# 减法
result_sub3 = {x - 2 for x in set}
print("减法运算：",result_sub3)
# 除法
result_div3 = {x / 2 for x in set}
print("除法运算：",result_div3)
print()

dict = {'a': 1, 'b': 2, 'c': 3}
# 加法
result_add4 = {key: value + 1 for key, value in dict.items()}
print("加法运算：",result_add4)
# 减法
result_sub4 = {key: value - 1 for key, value in dict.items()}
print("减法运算：",result_sub4)
# 除法
result_div4 = {key: value / 2 for key, value in dict.items()}
print("除法运算：",result_div4)
